﻿using System;
using CustomerContactSystem.Core.Model;

namespace CustomerContactSystem.WebForms.Admin.Sources {
    public partial class Create : BasePage {

        protected void Page_Load(object sender, EventArgs e) {
        }

        protected void CreateNewSourceClick(object sender, EventArgs e) {
            var source = new EnquirySource
                {
                   SourceName = SourceName.Text
                };

            if (!IsValidObject(source, CreateNewSourceResultMessage)) {
                return;
            }

            EnquirySourceRepository.Add(source);
            
            Response.Redirect("~/Admin/Sources/List.aspx");
        }
    }
}